import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

function dynamicPropsFn(route) {
  console.log(route.params);
  return {
    title: route.params.title,
    list: route.params.list
  };
}

const routes = [
  {
    path: "/",
    name: "/main",
    component: () => import("@/page/main.vue"),
    children: [
      {
        path: "/first/:title",
        name: "/first",
        component: () => import("@/page/firstPage/judge.vue"),
      },
      {
        path: "/main/second",
        name:'/main/second',
        component: () => import("@/page/secondPage/secondPage.vue")
      },{
        path: "/first/carDetail",
        // name:'/main/second',
        component: () => import("@/page/secondPage/carDetail.vue")
      }
    ]
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@/page/login.vue")
  }
];

const router = new VueRouter({
  // mode: 'history',
  mode: "hash",
  base: process.env.BASE_URL,
  routes
});

export default router;
